package iot.emulator;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * Created by dave on 18-7-21 上午11:07.
 */
@SpringBootApplication
public class Application implements ApplicationListener<ContextRefreshedEvent> {
    @Value("${plat.host}")
    private String host;
    @Value("${plat.port}")
    private int port;
    @Value("${plat.connection}")
    private int connection;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        Jtt808Emulator emu = new Jtt808Emulator(host, port, connection);
        emu.start();
    }
}
